<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Facades\Cache;


/**
 * App\Models\PostCatlog
 *
 * @property int $catid
 * @property int $fid 父级分类
 * @property string|null $name 分类名称
 * @property string|null $identifier
 * @property string $icon 图片
 * @property int $level 级别
 * @property int $enable 是否可选
 * @property int $available 是否可用
 * @property int $displayorder 显示顺序
 * @property string|null $keywords 关键字
 * @property string|null $description 描述
 * @property string|null $template_index 首页模板
 * @property string|null $template_list 列表页模板
 * @property string|null $template_detail 详细页模板
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\PostCatlog[] $childs
 * @property-read int|null $childs_count
 * @property-read \App\Models\PostCatlog $parent
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\PostItem[] $posts
 * @property-read int|null $posts_count
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\PostCatlog[] $siblings
 * @property-read int|null $siblings_count
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CatlogModel enable()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PostCatlog newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PostCatlog newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PostCatlog query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PostCatlog whereAvailable($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PostCatlog whereCatid($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PostCatlog whereDescription($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PostCatlog whereDisplayorder($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PostCatlog whereEnable($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PostCatlog whereFid($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PostCatlog whereIcon($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PostCatlog whereIdentifier($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PostCatlog whereKeywords($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PostCatlog whereLevel($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PostCatlog whereName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PostCatlog whereTemplateDetail($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PostCatlog whereTemplateIndex($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PostCatlog whereTemplateList($value)
 * @mixin \Eloquent
 */
class PostCatlog extends CatlogModel
{
    protected $table = 'post_catlog';

    public static function cacheName()
    {
        // TODO: Implement cacheName() method.
        return 'post_catlogs';
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function posts()
    {
        return $this->hasMany(PostItem::class, 'catid', 'catid');
    }
}
